﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000117693345";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCMFxd9W6fn9tlVoJGPCGCY+KLPgPhsN/DbKhSQN0Wg+oc/HemWUgitquN595E//mgNYjdnJ7JlcrBg/LTj8syysRrHFhTj2syZ/JDxR7aqk4jYxCblsi6F1e2tcPscmAorTwt0smdOV8DxOSJpfH1bq3eC+JnJjrcDhAeteuyoFwIpRroZ+3RSinZ3o8LizoesOfaGFnCI+cIiSrFyn0vTC9vn1o9iY+ktqq/OCMVDF7Df5msN4NhbBBDqiA3LgH0FJnmixyxcb9m53idcuDEKZaionmWjKLOxmk94Unti/6lIKeIqHay477tF+VUTADtjMguncdR1Mu9og07gqo5ZAgMBAAECggEAMw7fgtL7GXJAuBKzupvlCRvlyxdIc7jX0ik+IWnjuM5WqMxwLFdtzk4wZm2yxM4mgmo/oxs2y/7HBjJUg5gkvyQJjHIh3wIJ/D2vXiEzFGx9PfQP8TvF9QWJgONiwoMvgaVnmXrEaCtXqROX1TaIQfb2sgeFlY6saV2fprzcsE5VjanrHO3CofxXQvIT3ZJR5lhq2Dp90qIdRip/QhbODwo+yeWUcUKKcx6RLnxQyRTVyoRnOmD6VP7FVIyhD1gij6T2X55dNnnOhBVPXZGudhA9/BNc4LggQPxXEKiz8F8VKV6t6hQwMWHdcAlqfNN4ofKvGCtFZ1RXCnfsoihv+QKBgQDoT6tGsvCBw61HAYh+j+/1A7ARs7ZUn0aJLwj/WQS1q2/ea0Jm4tI9Q3dnnvOz6fySQ3HFhJOvHfR3t8IKINO18aUeLBN67VIUsx1wQJ7gHyiGve8mG8GHR97naaH943K+o4yUKq5NtQaiSfAYHHa4b+fqKFWoI8pKjxaGeV8t2wKBgQCaYA3dASF1h5DMcEiB/xPSzn801Q/a88v1qYso/phKmPSE6ZKRgAeyU91d3XDyVn6yq7GnXxJr0P6YzGDSuwRiVVZ3IVbZOukoOrwiUadzxnLTt8h3lLmUyk/+kHXWVd6cZl5V/CeEgox9LGf0VpErb9XKhmTivwJqbgvBai082wKBgQCq/pFUnbuX2F8/56n/dpUqZMeBkCVCDmbN7TgTNAPacNEMByk+L/CONY27UO2S3UUSp+Ajgd1uxX6/bBvAdr8+qhpephTEo9CJ+flOOdJ3p5ed7koMY9vEZqt07HTXO0anehyspunbusaiSAgYx0K/qWcsHPpHo+hvjvkGjGn5hwKBgHLcaTQ49SY3edtC6BAhNCSzlB5BMQzePLFKNsqHs9Q9PiHukClGM3PRxnFio/kLtjVGXmaD7HbgB6600o24rKhlinIVEkOK+5P9L6HxU0BnNWSl57hhpjs41JA5+BNDzOBdom8jsFt9rv4rniVEi7rf+Rg5KrMzH58ExiZg08vlAoGAHXSf7oytklydwzA2rUNyzfctySO7YktLCit43Jq4MxVOPF+Q3tepBDmNSsl7sqK8qgmb1hzSJ65DVpEIdRk8NT/EKMrP/LE+k4ZvC15wfjuTHjvons5H4BcAVpvL7yFsykLCNcn8PWzTRlLEz4Y5txQpgIz8ZfN/IlG7o2SBo2U=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjBcXfVun5/bZVaCRjwhgmPiiz4D4bDfw2yoUkDdFoPqHPx3pllIIrarjefeRP/5oDWI3ZyeyZXKwYPy04/LMsrEaxxYU49rMmfyQ8Ue2qpOI2MQm5bIuhdXtrXD7HJgKK08LdLJnTlfA8TkiaXx9W6t3gviZyY63A4QHrXrsqBcCKUa6Gft0Uop2d6PC4s6HrDn2hhZwiPnCIkqxcp9L0wvb59aPYmPpLaqvzgjFQxew3+ZrDeDYWwQQ6ogNy4B9BSZ5oscsXG/Zud4nXLgxCmWoqJ5loyizsZpPeFJ7Yv+pSCniKh2suO+7RflVEwA7YzILp3HUdTLvaINO4KqOWQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://127.0.0.1:8080/aumall/alipaysuccess.do";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://127.0.0.1:8080/aumall/alipaysuccess.do";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

